package com.example.applicationview.anim;

import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;

import androidx.appcompat.app.AppCompatActivity;

import com.example.applicationview.R;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * View Animation - Tween Animation（补间动画）（alpha、scale、translate、rotate、set）
 * alpha
 * fromXScale:起始x的比例
 * toXScale：结束x的比例
 * pivotX：起始x的坐标
 * pivotY：结束x的坐标
 *
 */
public class ActivityTweenAnimation extends AppCompatActivity {

    @BindView(R.id.view)
    View myView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_anim);
        ButterKnife.bind(this);
    }

    public void alpha(View view) {
                myView.startAnimation(AnimationUtils.loadAnimation(this, R.anim.alpha_anim));
    }

    public void scale(View view) {
        myView.startAnimation(AnimationUtils.loadAnimation(this, R.anim.scale_anim));
    }

    public void translate(View view) {
        myView.startAnimation(AnimationUtils.loadAnimation(this, R.anim.translate_anim));
    }

    public void rotate(View view) {
        myView.startAnimation(AnimationUtils.loadAnimation(this, R.anim.rotate_anim));
    }

    public void set(View view) {
        myView.startAnimation(AnimationUtils.loadAnimation(this, R.anim.set_anim));
    }
}
